import React from "react";
import { Button,  Radio,Form, Col, Row,Checkbox} from 'antd/lib';
import notification from "@/services/notification";
import {get} from "lodash";
import Uploads from "@/services/uploads";
import Upload from "antd/lib/upload";
import 'antd/dist/antd.less'
import {StarOutlined, UploadOutlined,DeleteOutlined} from '@ant-design/icons';
import { currentUser} from "@/services/auth";
import Attaches from "@/services/attaches";
import CreateAnnexDialog from "@/components/contract/settings/annexDialog";
import "./Attache.css";

export default class AttacheTab extends React.Component {
  state = {
    loading: true,
    status:0,
    annex0:[],//--附件
    annex1:[],//--附件
    annex2:[],//--附件
    annex3:[],//--附件
    annex4:[],//--附件
    annex5:[],//--附件
    annex6:[],//--附件
    annex7:[],//--附件
    annex8:[],//--附件
    annex9:[],//--附件
    annex10:[],//--附件
    annex11:[],//--附件
    annex12:[],//--附件
    annex13:[],//--附件
    annex14:[],//--附件
    annex15:[],//--附件
    annex16:[],//--附件
    annex17:[],//--附件
    annex18:[],//--附件
    annex19:[],//--附件
    annex20:[],//--附件
    annex21:[],//--附件
    annex22:[],//--附件
    annex23:[],//--附件
    annex24:[],//--附件
    annex25:[],//--附件
    annex26:[],//--附件
    annexlawyer:[],
    flagdaili:"0",
  };
  componentWillMount() {
    Attaches.get({sourceid:this.props.id,type:this.props.billtype }).then(data => {
      let item=[];
      let itemlawyer=[];
      data.annex.forEach(file => {
        if(file.url.indexOf("static/file/")<0){
          file.url='static/file/'+file.url;
        }
        if(file.type==="lawyer") {

          if (itemlawyer.length < 1) {
            itemlawyer = [file];
          } else {
            itemlawyer.push.apply(itemlawyer, [file]);
          }
        }else{
          if (item.length < 1) {
            item = [file];
          } else {
            item.push.apply(item, [file]);
          }
        }
      });
      this.annexadd(item,itemlawyer,this.props.status);
    }).catch(error => {
      this.annexadd([],[],this.props.status);
    });
  }
  annexadd(annex,annexlawyer,status){
    let  annex0 = [];//--附件
    let  annex1 = [];//--附件
    let  annex2 = [];//--附件
    let  annex3 = [];//--附件
    let  annex4 = [];//--附件
    let  annex5 = [];//--附件
    let  annex6 = [];//--附件
    let  annex7 = [];//--附件
    let  annex8 = [];//--附件
    let  annex9 = [];//--附件
    let  annex10 = [];//--附件
    let  annex11 = [];//--附件
    let  annex12 = [];//--附件
    let  annex13 = [];//--附件
    let  annex14 = [];//--附件
    let  annex15 = [];//--附件
    let  annex16 = [];//--附件
    let  annex17 = [];//--附件
    let  annex18 = [];//--附件
    let  annex19 = [];//--附件
    let  annex20 = [];
    let  annex21 = [];
    let  annex22 = [];
    let  annex23 = [];
    let annex24= [];
    let annex25= [];
    let annex26= [];
    annex.forEach(file => {
      if(file.url.indexOf("static/file/")<0){
        file.url='static/file/'+file.url;
      }
      if(file.nature===1){
        if (annex1.length < 1) {
          annex1 = [file];
        } else {
          annex1.push.apply(annex1, [file]);
        }
      }else if(file.nature===2){
        if (annex2.length < 1) {
          annex2 = [file];
        } else {
          annex2.push.apply(annex2, [file]);
        }
      }else if(file.nature===3){
        if (annex3.length < 1) {
          annex3 = [file];
        } else {
          annex3.push.apply(annex3, [file]);
        }
      }else if(file.nature===4){
        if (annex4.length < 1) {
          annex4 = [file];
        } else {
          annex4.push.apply(annex4, [file]);
        }
      }else if(file.nature===5){
        if (annex5.length < 1) {
          annex5 = [file];
        } else {
          annex5.push.apply(annex5, [file]);
        }
      }else if(file.nature===6){
        if (annex6.length < 1) {
          annex6 = [file];
        } else {
          annex6.push.apply(annex6, [file]);
        }
      }else if(file.nature===7){
        if (annex7.length < 1) {
          annex7 = [file];
        } else {
          annex7.push.apply(annex7, [file]);
        }
      }else if(file.nature===8){
        if (annex8.length < 1) {
          annex8 = [file];
        } else {
          annex8.push.apply(annex8, [file]);
        }
      }else if(file.nature===9){
        if (annex9.length < 1) {
          annex9 = [file];
        } else {
          annex9.push.apply(annex9, [file]);
        }
      }else if(file.nature===10){
        if (annex10.length < 1) {
          annex10 = [file];
        } else {
          annex10.push.apply(annex10, [file]);
        }
      }else if(file.nature===11){
        if (annex11.length < 1) {
          annex11 = [file];
        } else {
          annex11.push.apply(annex11, [file]);
        }
      }else if(file.nature===12){
        if (annex12.length < 1) {
          annex12 = [file];
        } else {
          annex12.push.apply(annex12, [file]);
        }
      }else if(file.nature===13){
        if (annex13.length < 1) {
          annex13 = [file];
        } else {
          annex13.push.apply(annex13, [file]);
        }
      }else if(file.nature===14){
        if (annex14.length < 1) {
          annex14 = [file];
        } else {
          annex14.push.apply(annex14, [file]);
        }
      }else if(file.nature===15){
        if (annex15.length < 1) {
          annex15 = [file];
        } else {
          annex15.push.apply(annex15, [file]);
        }
      }else if(file.nature===16){
        if (annex16.length < 1) {
          annex16 = [file];
        } else {
          annex16.push.apply(annex16, [file]);
        }
      }else if(file.nature===17){
        if (annex17.length < 1) {
          annex17 = [file];
        } else {
          annex17.push.apply(annex17, [file]);
        }
      }else if(file.nature===18){
        if (annex18.length < 1) {
          annex18 = [file];
        } else {
          annex18.push.apply(annex18, [file]);
        }
      }else if(file.nature===19){
        if (annex19.length < 1) {
          annex19 = [file];
        } else {
          annex19.push.apply(annex19, [file]);
        }
      }else if(file.nature===20){
        if (annex20.length < 1) {
          annex20 = [file];
        } else {
          annex20.push.apply(annex20, [file]);
        }
      }else if(file.nature===21){
        if (annex21.length < 1) {
          annex21 = [file];
        } else {
          annex21.push.apply(annex21, [file]);
        }
      }else if(file.nature===22){
        if (annex22.length < 1) {
          annex22 = [file];
        } else {
          annex22.push.apply(annex22, [file]);
        }
      }else if(file.nature===23){
        if (annex23.length < 1) {
          annex23 = [file];
        } else {
          annex23.push.apply(annex23, [file]);
        }
      }else if(file.nature===24){
        if (annex24.length < 1) {
          annex24 = [file];
        } else {
          annex24.push.apply(annex24, [file]);
        }
      }else if(file.nature===25){
        if (annex25.length < 1) {
          annex25 = [file];
        } else {
          annex25.push.apply(annex25, [file]);
        }
      }else if(file.nature===26){
        if (annex26.length < 1) {
          annex26 = [file];
        } else {
          annex26.push.apply(annex26, [file]);
        }
      }else{
        if (annex0.length < 1) {
          annex0 = [file];
        } else {
          annex0.push.apply(annex0, [file]);
        }
      }
    });
    let flagdaili="0"
    let dailicount=annex1.length+annex2.length+annex5.length+annex9.length+annex21.length+
      annex14.length+annex3.length+annex4.length+annex18.length+annex10.length;
    let yuannei=annex24.length+annex25.length+annex7.length+ annex11.length+annex6.length+
       annex12.length+annex15.length+annex16.length+annex20.length+annex22.length+
       annex23.length+annex19.length+annex17.length+annex26.length;

    if(dailicount>0 || annex.length===0){
      flagdaili="0";
    }else if(yuannei>0){
      flagdaili="1";
    }else{
      flagdaili="2";
    }
    this.setState({
      annex0:annex0,//--附件
      annex1:annex1,//--附件
      annex2:annex2,//--附件
      annex3:annex3,//--附件
      annex4:annex4,//--附件
      annex5:annex5,//--附件
      annex6:annex6,//--附件
      annex7:annex7,//--附件
      annex8:annex8,//--附件
      annex9:annex9,//--附件
      annex10:annex10,//--附件
      annex11:annex11,//--附件
      annex12:annex12,//--附件
      annex13:annex13,//--附件
      annex14:annex14,//--附件
      annex15:annex15,//--附件
      annex16:annex16,//--附件
      annex17:annex17,//--附件
      annex18:annex18,//--附件
      annex19:annex19,//--附件
      annex20:annex20,//--附件
      annex21:annex21,//--附件
      annex22:annex22,//--附件
      annex23:annex23,//--附件
      annex24:annex24,//--附件
      annex25:annex25,//--附件
      annex26:annex26,//--附件
      annexlawyer:annexlawyer,
      status:status,
      flagdaili:flagdaili,
    });
  }
   handledown(file){
     let  filename=file.url;
     let names=file.name;
     if(names.split('.')[1]!==filename.split('.')[1]){
      filename=filename.split('.')[0] +'.'+names.split('.')[1];
     }
     let AjaxUrl = 'api/upload/downloadfile';
     fetch(AjaxUrl ,{
      method: 'POST',
      body: window.JSON.stringify({filename: filename}),
      credentials: 'include',
      headers: new Headers({
        'Content-Type': 'application/json'
      })}).then((response) => {
      response.blob().then(blob => {
        const aLink = document.createElement('a');
        document.body.appendChild(aLink);
        aLink.style.display='none';
        const objectUrl = window.URL.createObjectURL(blob);
        aLink.href = objectUrl;
        aLink.download = names;
        aLink.click();
        document.body.removeChild(aLink);
      });
    }).catch((error) => {
      console.log(error);
    });
  };
  getPdfURL(nature){
    const _this = this;
    const props = {
        name: 'file',
        action: 'api/upload/uploadfile/'+_this.props.billtype+'/editor/'+_this.props.status+'/'+nature+'/'+_this.props.id,
        headers: {
            authorization: 'authorization-text',
        },
     onChange(info) {
            let fileList = [...info.fileList];
       var newd=[];
        fileList.forEach(file => {
              if (file.response) {
                // Component will show file.url as link
                file.url = 'static/file/'+file.response.filename;
              }
              let status = _this.state.status;
              if(file.bytstatus>=0){
                status=file.bytstatus;
              }
         // if(file.status==="done") {
             const b=[{
                      uid: file.uid,
                      name: file.name,
                      status: file.status,
                      bytstatus: status,
                      nature: nature,
                      url: file.url
              }];
            if (newd.length < 1) {
              newd = b;
            } else {
              newd.push.apply(newd, b);
            }
         // }
            });
            if(nature===1){
              _this.setState({ annex1:newd });
            }else if(nature===2){
              _this.setState({ annex2:newd });
            }else if(nature===3){
              _this.setState({ annex3:newd });
            }else if(nature===4){
              _this.setState({ annex4:newd });
            }else if(nature===5){
              _this.setState({ annex5:newd });
            }else if(nature===6){
              _this.setState({ annex6:newd });
            }else if(nature===7){
              _this.setState({ annex7:newd });
            }else if(nature===8){
              _this.setState({ annex8:newd });
            }else if(nature===9){
              _this.setState({ annex9:newd });
            }else if(nature===10){
              _this.setState({ annex10:newd });
            }else if(nature===11){
              _this.setState({ annex11:newd });
            }else if(nature===12){
              _this.setState({ annex12:newd });
            }else if(nature===13){
              _this.setState({ annex13:newd });
            }else if(nature===14){
              _this.setState({ annex14:newd });
            }else if(nature===15){
              _this.setState({ annex15:newd });
            }else if(nature===16){
              _this.setState({ annex16:newd });
            }else if(nature===17){
              _this.setState({ annex17:newd });
            }else if(nature===18){
              _this.setState({ annex18:newd });
            }else if(nature===19){
              _this.setState({ annex19:newd });
            }else if(nature===20){
              _this.setState({ annex20:newd });
            }else if(nature===21){
              _this.setState({ annex21:newd });
            }else if(nature===22){
              _this.setState({ annex22:newd });
            }else if(nature===23){
              _this.setState({ annex23:newd });
            }else if(nature===24){
              _this.setState({ annex24:newd });
            }else if(nature===25){
              _this.setState({ annex25:newd });
            }else if(nature===26){
              _this.setState({ annex26:newd });
            }else{
              _this.setState({ annex0:newd });
            }
          },
       onDownload: this.handledown,
       onRemove(infos){
        let uid=infos.uid;
        const id=_this.props.id;
        Uploads.removefile({sourcetype: _this.props.billtype,sourceid:id,uid:uid}).then(data => {
             if(data.code==="sucess"){
                notification.success(data.msg);
             }
             else{
              notification.error(data.msg);
              }
            }).catch(error => {
              notification.error(get(error, "response.data.message", "删除失败."));
            });
       },
        showUploadList: {
        showDownloadIcon: true,
        downloadIcon: '下载',
        showRemoveIcon: true,
        removeIcon: <DeleteOutlined onClick={e => console.log(e, 'custom removeIcon event')} />,
      },
    };
    return props;
};
getPdfURLlawyer(){
  const _this = this;
  const props = {
      name: 'file',
      action: 'api/upload/uploadfile/'+_this.props.billtype+'/lawyer/0/0/'+_this.props.id,
      headers: {
          authorization: 'authorization-text',
      },
   //  onChange: this.handleChange,
   onChange(info) {
          let fileList = [...info.fileList];

          // 1. Limit the number of uploaded files
          // Only to show two recent uploaded files, and old ones will be replaced by the new
          // fileList = fileList.slice(-2);
          // 2. Read from response and show file link
     var newd=[];
      fileList.forEach(file => {
            if (file.response) {
              // Component will show file.url as link
              file.url = 'static/file/'+file.response.filename;
            }
            let status = _this.state.status;
            if(file.bytstatus>=0){
              status=file.bytstatus;
            }
       // if(file.status==="done") {
           const b=[{
                    uid: file.uid,
                    name: file.name,
                    status: file.status,
                    bytstatus: status,
                    nature:0,
                    url: file.url
            }];
          if (newd.length < 1) {
            newd = b;
          } else {
            newd.push.apply(newd, b);
          }
       // }
          });
          _this.setState({ annexlawyer:newd });
        },
     onDownload: this.handledown,
     onRemove(infos){
      let uid=infos.uid;
      const id=_this.props.id;
      Uploads.removefile({sourcetype: _this.props.billtype,sourceid:id,uid:uid}).then(data => {
           if(data.code==="sucess"){
              notification.success(data.msg);
           }
           else{
            notification.error(data.msg);
            }
          }).catch(error => {
            notification.error(get(error, "response.data.message", "删除失败."));
          });
     },
      showUploadList: {
      showDownloadIcon: true,
      downloadIcon: '下载',
      showRemoveIcon: true,
      removeIcon: <DeleteOutlined onClick={e => console.log(e, 'custom removeIcon event')} />,
    },
  };
  return props;
};
fieldedit(field){
  if(!this.props.isedit){
    return true;
  }
  if(this.props.colcontrol){
    if(this.props.allow_col.indexOf(field)>=0){
      return false;
    }else{
      return true;
    }
  }else{
    return false;
  }
}
handleselannex = () => {
  let orgunitid=this.state.departmentid;

  CreateAnnexDialog.showModal({orgunitid: orgunitid})
  .onClose((result = {}) => {
      if (result.success) {
        let annex0=this.state.annex0;
            if (annex0.length < 1) {
              annex0 = result.annex;
            } else {
              annex0.push.apply(annex0, result.annex);
            }
            // }
            // });
            this.setState({ annex0:annex0 });
      }
    }).onDismiss(() => {
    //  navigateTo("orgstruct", true);
    });
};
  // ===================================zhuijiafujian===================
  render() {
    //if (this.state.loading) return null;
    return(
    <div>
      <table border="1px" className="fujiantable" width={document.querySelector('body').offsetWidth*0.8}>
      <tr>
        <td > <Radio.Group onChange={e => {
                  this.setState({flagdaili:e.target.value});}}
             value={this.state.flagdaili} disabled={this.fieldedit("annex")}>
              <Radio value={"0"}>招标代理机构采购</Radio>
              <Radio value={"1"}>院内采购部采购</Radio>
              <Radio value={"2"}>业务科室采购或经办</Radio>
            </Radio.Group></td>
      </tr>
      {this.state.flagdaili==="0" &&(<tr>
        <td>
          <Checkbox
            checked ={this.state.annex1.length>0 ? true:false}
            autoFocus
          />1、同意立项院长办公会会议纪要
          <Upload {...this.getPdfURL(1)} fileList={this.state.annex1} 
              disabled ={this.fieldedit("annex")}  >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="0" &&(<tr><td>
          <Checkbox
            checked ={this.state.annex2.length>0 ? true:false}
            autoFocus
          />2、同意立项党委会会议纪要
          <Upload {...this.getPdfURL(2)} fileList={this.state.annex2} 
              disabled ={this.fieldedit("annex")}  >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="0" &&(<tr><td>
          <Checkbox
            checked ={this.state.annex5.length>0 ? true:false}
            autoFocus
          />3、采购文件审核表
          <Upload {...this.getPdfURL(5)} fileList={this.state.annex5} 
              disabled ={this.fieldedit("annex")}  >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="0" &&(<tr><td><Checkbox
            checked ={this.state.annex9.length>0 ? true:false}
            autoFocus
          />4、代理机构盖章版采购文件
          <Upload {...this.getPdfURL(9)} fileList={this.state.annex9} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="0" &&(<tr><td><Checkbox
            checked ={this.state.annex21.length>0 ? true:false}
            autoFocus
          />5、中标供应商投标（响应）文件
          <Upload {...this.getPdfURL(21)} fileList={this.state.annex21} 
                disabled ={this.fieldedit("annex")}>
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="0" &&(<tr><td><Checkbox
            checked ={this.state.annex14.length>0 ? true:false}
            autoFocus
          />6、招标代理机构评标（评审）报告
          <Upload {...this.getPdfURL(14)} fileList={this.state.annex14} 
              disabled ={this.fieldedit("annex")}  >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="0" &&(<tr><td>
          <Checkbox
            checked ={this.state.annex3.length>0 ? true:false}
            autoFocus
          />7、通报采购结果院长办公会会议纪要
          <Upload {...this.getPdfURL(3)} fileList={this.state.annex3} 
              disabled ={this.fieldedit("annex")}  >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="0" &&(<tr><td>
          <Checkbox
            checked ={this.state.annex4.length>0 ? true:false}
            autoFocus
          />8、通报采购结果党委会会议纪要
          <Upload {...this.getPdfURL(4)} fileList={this.state.annex4} 
              disabled ={this.fieldedit("annex")}  >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="0" &&(<tr><td><Checkbox
            checked ={this.state.annex18.length>0 ? true:false}
             // onChange={handleis_activeChange}
            autoFocus
          />9、中标（成交）通知书
          <Upload {...this.getPdfURL(18)} fileList={this.state.annex18} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="0" &&(<tr><td><Checkbox
            checked ={this.state.annex10.length>0 ? true:false}
            autoFocus
          />10、备案文件(上传此项，第4、6、9项不传)
          <Upload {...this.getPdfURL(10)} fileList={this.state.annex10} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
    {this.state.flagdaili==="1" &&(
      //  <tr>
      //   <td ><b>院内采购部采购</b></td>
      // </tr>
      <tr>
        <td>
          <Checkbox
            checked ={this.state.annex24.length>0 ? true:false}
            autoFocus
          />1、同意立项院长办公会会议纪要
          <Upload {...this.getPdfURL(24)} fileList={this.state.annex24} 
              disabled ={this.fieldedit("annex")}  >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td>
          <Checkbox
            checked ={this.state.annex25.length>0 ? true:false}
            autoFocus
          />2、同意立项党委会会议纪要
          <Upload {...this.getPdfURL(25)} fileList={this.state.annex25} 
              disabled ={this.fieldedit("annex")}  >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td><Checkbox
            checked ={this.state.annex7.length>0 ? true:false}
            autoFocus
          />3、比选文件审核表
          <Upload {...this.getPdfURL(7)} fileList={this.state.annex7} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload> </td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td><Checkbox
            checked ={this.state.annex11.length>0 ? true:false}
            autoFocus
          />4、比选文件
          <Upload {...this.getPdfURL(11)} fileList={this.state.annex11} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td>
          <Checkbox
            checked ={this.state.annex6.length>0 ? true:false}
            autoFocus
          />5、院官网发布院内比选公告截图
          <Upload {...this.getPdfURL(6)} fileList={this.state.annex6} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload> </td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td><Checkbox
            checked ={this.state.annex12.length>0 ? true:false}
            autoFocus
          />6、供应商报名表
          <Upload {...this.getPdfURL(12)} fileList={this.state.annex12} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td><Checkbox
            checked ={this.state.annex15.length>0 ? true:false}
            autoFocus
          />7、专家抽取表
          <Upload {...this.getPdfURL(15)} fileList={this.state.annex15} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td><Checkbox
            checked ={this.state.annex16.length>0 ? true:false}
            autoFocus
          />8、供应商及专家签到表
          <Upload {...this.getPdfURL(16)} fileList={this.state.annex16} 
              disabled ={this.fieldedit("annex")}  >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td><Checkbox
            checked ={this.state.annex20.length>0 ? true:false}
             // onChange={handleis_activeChange}
            autoFocus
          />9、专家打分表及汇总表
          <Upload {...this.getPdfURL(20)} fileList={this.state.annex20} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td><Checkbox
            checked ={this.state.annex22.length>0 ? true:false}
            autoFocus
          />10、比选现场记录
          <Upload {...this.getPdfURL(22)} fileList={this.state.annex22} 
                disabled ={this.fieldedit("annex")}>
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td><Checkbox
            checked ={this.state.annex23.length>0 ? true:false}
            autoFocus
          />11、供应商比选响应文件（包括所有参选供应商）
          <Upload {...this.getPdfURL(23)} fileList={this.state.annex23} 
                disabled ={this.fieldedit("annex")}>
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td><Checkbox
            checked ={this.state.annex19.length>0 ? true:false}
             // onChange={handleis_activeChange}
            autoFocus
          />12、院长办公会立项同意采购结果会议纪要
          <Upload {...this.getPdfURL(19)} fileList={this.state.annex19} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td><Checkbox
            checked ={this.state.annex17.length>0 ? true:false}
            autoFocus
          />13、党委会同意采购结果会议纪要
          <Upload {...this.getPdfURL(17)} fileList={this.state.annex17} 
              disabled ={this.fieldedit("annex")}  >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
          {this.state.flagdaili==="1" &&(<tr><td><Checkbox
            checked ={this.state.annex26.length>0 ? true:false}
            autoFocus
          />14、院官网发布采购结果公告截图或中标（成交）通知书
          <Upload {...this.getPdfURL(26)} fileList={this.state.annex26} 
              disabled ={this.fieldedit("annex")}  >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
    {this.state.flagdaili==="2" &&(
      //  <tr>
      //   <td ><b>业务科室自行采购（＜1万）</b></td>
      // </tr>
      <tr><td><Checkbox
            checked ={this.state.annex8.length>0 ? true:false}
            autoFocus
          />1、申请表
          <Upload {...this.getPdfURL(8)} fileList={this.state.annex8} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload> </td></tr>)}
          {this.state.flagdaili==="2" &&(<tr><td><Checkbox
            checked ={this.state.annex13.length>0 ? true:false}
            autoFocus
          />采购过程资料（谈价记录、资质等）
          <Upload {...this.getPdfURL(13)} fileList={this.state.annex13} 
               disabled ={this.fieldedit("annex")} >
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>)}
      <tr><td><Checkbox
            checked ={this.state.annex0.length>0 ? true:false}
            autoFocus
          />{this.state.flagdaili==="0" ? '11、':(this.state.flagdaili==="1" ? '15、':'3、')}其他附件
            { !this.fieldedit("annex") &&(<Button type="primary" style={{margin:"5px"}} onClick={() => this.handleselannex()} 
              disabled ={this.fieldedit("annex")}>
              <i className="fa fa-tablet m-r-5" />
                选择部门和公共附件
              </Button>)}
          <Upload {...this.getPdfURL(0)} fileList={this.state.annex0} 
                disabled ={this.fieldedit("annex")}>
            { !this.fieldedit("annex") &&(<Button>
              <UploadOutlined /> 上传
            </Button>)}
          </Upload></td></tr>
      <tr><td>{ this.fieldedit("annexlawyer") ? "":"律师意见"}
          <Upload {...this.getPdfURLlawyer()} fileList={this.state.annexlawyer}
          disabled ={this.fieldedit("annexlawyer")}>
                { !this.fieldedit("annexlawyer") &&(<Button>
                  <UploadOutlined /> 律师意见
                </Button>)}
              </Upload></td></tr>
      </table>
      </div>
    );
  };
}

